package com.songyang.mybatis.exectuor;

import com.songyang.mybatis.mapping.BoundSql;
import com.songyang.mybatis.mapping.MappedStatement;
import com.songyang.mybatis.session.ResultHandler;
import com.songyang.mybatis.transaction.Transaction;

import java.sql.SQLException;
import java.util.List;

/**
 * @ClassName Executor
 * @Description 执行器
 * @date 2023/3/27 11:37
 * @Author yanceysong
 * @Version 1.0
 */
public interface Executor {
    ResultHandler NO_RESULT_HANDLER = null;

    <E> List<E> query(MappedStatement ms, Object parameter, ResultHandler resultHandler, BoundSql boundSql);

    Transaction getTransaction();

    void commit(boolean required) throws SQLException;

    void rollback(boolean required) throws SQLException;

    void close(boolean forceRollback);
}
